#include <stdio.h>
#include <string.h>
#include "dlist.h"

typedef struct
{
  dlist_node_t node;
  int value;
}dlist_int_t;

int print_process(void *arg, dlist_node_t * p_node){
  printf("%d\n", ((dlist_int_t *)p_node)->value);
  return 0;
}

int main() {
    printf("Hello, World!\n");
    dlist_head_t head;
    dlist_int_t node1, node2, node3;
    memset(&node1, 0, sizeof(node1));
    memset(&node2, 0, sizeof(node2));
    memset(&node3, 0, sizeof(node3));

    dlist_init(&head);
    node1.value = 1;
    node2.value = 2;
    node3.value = 3;
    dlist_add_head(&head, &(node1.node));
    dlist_add_tail(&head, &(node2.node));
    dlist_add_head(&head, &(node3.node));

    dlist_foreach(&head, print_process, NULL);
    
    return 0;
}
